package edu.hgnc.selfEditor2;

import java.beans.PropertyEditorSupport;

/**
 * 属性编辑器，用于解析指定的文本格式
 */
public class AddressPropertyEditor extends PropertyEditorSupport {
	/**
	 * @param text The string to be parsed.
	 */
	@Override
	public void setAsText(String text) throws IllegalArgumentException {
		// 字符分割并设置属性
		String[] s = text.split("_");
		Address address = new Address();
		address.setProvince(s[0]);
		address.setCity(s[1]);
		address.setCounty(s[2]);
		address.setTown(s[3]);
		address.setDetail(s[4]);
		this.setValue(address);
	}
}
